using System;

namespace OrbitOne.CRMLyncInfoDashboard.Setup
{
    public class LyncExtensionRegistryEntry
    {
        public int DefaultContextPackage { get; private set; }
        public int ExtensibilityApplicationType { get; private set; }
        public int ExtensibilityWindowSize { get; private set; }
        public string ExternalUrl { get; private set; }
        public string InternalUrl { get; private set; }
        public string Name { get; private set; }


        public LyncExtensionRegistryEntry(bool defaultContextPackage, string externalUrl, string internalUrl, string name, int extensibilityApplicationType, int extensibilityWindowSize)
        {
            ExtensibilityWindowSize = extensibilityWindowSize;
            ExtensibilityApplicationType = extensibilityApplicationType;
            DefaultContextPackage = defaultContextPackage ? 1 : 0;
            ExternalUrl = GetDashboardUrl(externalUrl);
            InternalUrl = GetDashboardUrl(internalUrl);
            Name = name;
        }

        private string GetDashboardUrl(string url)
        {
            url = url.TrimEnd('/');
            return string.Format("{0}/{1}", url, "WebResources/orb_DashboardHost");
        }
    }
}